package main

import "fmt"

var graph = make(map[string]map[string]bool)

func main() {
	addEdge("1", "2")
	addEdge("2", "3")
	addEdge("3", "4")
	fmt.Println(hasEdge("1", "2"))
	fmt.Println(hasEdge("2", "3"))
	fmt.Println(hasEdge("3", "4"))
	fmt.Println(hasEdge("4", "5"))
}

func addEdge(from, to string) {
	edges := graph[from]
	if edges == nil {
		edges = make(map[string]bool)
		graph[from] = edges
	}
	edges[to] = true
}
func hasEdge(from, to string) bool {
	return graph[from][to]
}
